/*
 * mainWindow.cpp
 * Contains the main loop. Doesn't do much for now besides checking for button presses
 * (which adds points to the score) and checking for program exit.
 *
 *  Created on: 07.06.2010
 *      Author: Simon Dehne
 */

#include <windows.h>

#include "GUI.h"
#include "Window.h"
#include "Block.h"

using namespace std;

// Event structure that will be used
SDL_Event event;

// --------------------------------------------------------------------------
// Main Window
// --------------------------------------------------------------------------
int main(int argc, char* args[])
{
	// keeps track of whether the user wants to quit
	bool quit = false;

	// Initialize and load level 1
	Window window;
	window.init();
	window.load();
	window.loadLevel("1");

	// Create a block
	Block block;


	// Main loop
	// while there's no quit signal
	while(quit == false)
	{
		// refresh the GUI
		window.refreshGUI();

		// and while there's an event to handle
		while(SDL_PollEvent(&event))
		{
			// DEBUG: add points on any button press
			if(event.type == SDL_KEYDOWN)
			{
				window.getGUI().addPoints(20);

			}

			// If the user send a quit message
			if(event.type == SDL_QUIT)
			{
				// break the main loop
				quit = true;
			}
		}
	}

	// Clean up and quit SDL
	window.cleanUp();
	return 0;
}
